package com.xiyue.leaspring.po;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

import org.hibernate.annotations.ManyToAny;

@SuppressWarnings("serial")
@Cacheable(true)
@Entity
@Table(name = "dept")
public class Dept implements Serializable {//持久化类

	@Id//主键类
	@GeneratedValue(strategy = GenerationType.IDENTITY)//主键生成方式
	private Long deptno;//字段映射(属性名称=字段名称)
	private String dname;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="cid")
	private Company company;
	public Long getDeptno() {
		return deptno;
	}
	public void setDeptno(Long deptno) {
		this.deptno = deptno;
	}
	public String getDname() {
		return dname;
	}
	public void setDname(String dname) {
		this.dname = dname;
	}
	public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}
	@Override
	public String toString() {
		return "Dept [deptno=" + deptno + ", dname=" + dname + ", company=" + company + "]";
	}
}
